            <!-- manual page source format generated by PolyglotMan v3.2, -->
<!-- available at http://polyglotman.sourceforge.net/ -->

<html>
<head>
<title>UNZIPSFX(1) manual page</title>
</head>
<body bgcolor='white'>
<a href='#toc'>Table of Contents</a><p>

<h2><a name='sect0' href='#toc0'>Name</a></h2>
unzipsfx - self-extracting stub for prepending to ZIP archives
 
<h2><a name='sect1' href='#toc1'>Synopsis</a></h2>
<b>&lt;name of unzipsfx+archive combo&gt;</b> [<b>-cfptuz</b>[<b>ajnoqsCLV$</b>]] [<i>file(s)</i>&nbsp;... [<b>-x</b>&nbsp;<i>xfile(s)</i>&nbsp;...]]
  
<h2><a name='sect2' href='#toc2'>Description</a></h2>
<i>unzipsfx</i> is a modified version of <a href='unzip.1'><i>unzip</i>(1)</a>
 designed to be
prepended to existing ZIP archives in order to form self-extracting archives.
Instead of taking its first non-flag argument to be the zipfile(s) to be
extracted, <i>unzipsfx</i> seeks itself under the name by which it was invoked
and tests or extracts the contents of the appended archive.  Because the
executable stub adds bulk to the archive (the whole purpose of which is
to be as small as possible), a number of the less-vital capabilities in
regular <i>unzip</i> have been removed.  Among these are the usage (or help) screen,
the listing and diagnostic functions (<b>-l</b> and <b>-v</b>), the ability to decompress
older compression formats (the &lsquo;&lsquo;reduce,&rsquo;&rsquo; &lsquo;&lsquo;shrink&rsquo;&rsquo; and &lsquo;&lsquo;implode&rsquo;&rsquo; methods).  The
ability to extract to a directory other than the current one can be selected
as a compile-time option, which is now enabled by default since UnZipSFX
version 5.5.  Similarly, decryption is supported as a compile-time option
but should be avoided unless the attached archive contains encrypted files.
Starting with release 5.5, another compile-time option adds a simple &lsquo;&lsquo;run
command after extraction&rsquo;&rsquo; feature.  This feature is currently incompatible
with the &lsquo;&lsquo;extract to different directory&rsquo;&rsquo; feature and remains disabled by
default. <p>
<b>Note that self-extracting archives made with</b> <i>unzipsfx</i> <b>are no more
(or less) portable across different operating systems than is the</b> <i>unzip</i>
<b>executable itself.</b>  In general a self-extracting archive made on a particular
Unix system, for example, will only self-extract under the same flavor of
Unix.  Regular <i>unzip</i> may still be used to extract the embedded archive as
with any normal zipfile, although it will generate a harmless warning about
extra bytes at the beginning of the zipfile. <i>Despite this</i>, however, the
self-extracting archive is technically <i>not</i> a valid ZIP archive, and PKUNZIP
may be unable to test or extract it.  This limitation is due to the simplistic
manner in which the archive is created; the internal directory structure
is not updated to reflect the extra bytes prepended to the original zipfile.
  
<h2><a name='sect3' href='#toc3'>Arguments</a></h2>

<dl>

<dt>[<i>file(s)</i>]</dt>
<dd>An optional list of archive members to be processed.
Regular expressions (wildcards) similar to those in Unix <a href='egrep.1'><i>egrep</i>(1)</a>
 may be
used to match multiple members.  These wildcards may contain: <blockquote></dd>

<dt>*</dt>
<dd>matches a
sequence of 0 or more characters </dd>

<dt>?</dt>
<dd>matches exactly 1 character </dd>

<dt>[...]</dt>
<dd>matches
any single character found inside the brackets; ranges are specified by
a beginning character, a hyphen, and an ending character.  If an exclamation
point or a caret (&lsquo;!&rsquo; or &lsquo;^&rsquo;) follows the left bracket, then the range of characters
within the brackets is complemented (that is, anything <i>except</i> the characters
inside the brackets is considered a match). </dd>
</dl>
</blockquote>

<dl>

<dt>(Be sure to quote any character
that might otherwise be interpreted or </dt>
<dd>modified by the operating system,
particularly under Unix and VMS.) </dd>

<dt>[<b>-x</b>&nbsp;<i>xfile(s)</i>]</dt>
<dd>An optional list of archive
members to be excluded from processing. Since wildcard characters match
directory separators (&lsquo;/&rsquo;), this option may be used to exclude any files
that are in subdirectories.  For example, &lsquo;&lsquo;foosfx *.[ch] -x */*&rsquo;&rsquo; would extract
all C source files in the main directory, but none in any subdirectories.
 Without the <b>-x</b> option, all C source files in all directories within the
zipfile would be extracted. </dd>
</dl>
<p>
If <i>unzipsfx</i> is compiled with SFX_EXDIR defined,
the following option is also enabled: 
<dl>

<dt>[<b>-d</b>&nbsp;<i>exdir</i>]</dt>
<dd>An optional directory to
which to extract files.  By default, all files and subdirectories are recreated
in the current directory; the <b>-d</b> option allows extraction in an arbitrary
directory (always assuming one has permission to write to the directory).
 The option and directory may be concatenated without any white space between
them, but note that this may cause normal shell behavior to be suppressed.
 In particular, &lsquo;&lsquo;-d&nbsp;~&rsquo;&rsquo; (tilde) is expanded by Unix C shells into the name of
the user&rsquo;s home directory, but &lsquo;&lsquo;-d~&rsquo;&rsquo; is treated as a literal subdirectory &lsquo;&lsquo;<b>~</b>&rsquo;&rsquo;
of the current directory.   </dd>
</dl>

<h2><a name='sect4' href='#toc4'>Options</a></h2>
<i>unzipsfx</i> supports the following <a href='unzip.1'><i>unzip</i>(1)</a>

options:  <b>-c</b> and <b>-p</b> (extract to standard output/screen), <b>-f</b> and <b>-u</b> (freshen
and update existing files upon extraction), <b>-t</b> (test archive) and <b>-z</b> (print
archive comment).  All normal listing options (<b>-l</b>, <b>-v</b> and <b>-Z</b>) have been removed,
but the testing option (<b>-t</b>) may be used as a &lsquo;&lsquo;poor man&rsquo;s&rsquo;&rsquo; listing.  Alternatively,
those creating self-extracting archives may wish to include a short listing
in the zipfile comment. <p>
See <a href='unzip.1'><i>unzip</i>(1)</a>
 for a more complete description of
these options.   
<h2><a name='sect5' href='#toc5'>Modifiers</a></h2>
<i>unzipsfx</i> currently supports all <a href='unzip.1'><i>unzip</i>(1)</a>
 modifiers:
 <b>-a</b> (convert text files), <b>-n</b> (never overwrite), <b>-o</b> (overwrite without prompting),
<b>-q</b> (operate quietly), <b>-C</b> (match names case-insensitively), <b>-L</b> (convert uppercase-OS
names to lowercase), <b>-j</b> (junk paths) and <b>-V</b> (retain version numbers); plus
the following operating-system specific options:  <b>-X</b> (restore VMS owner/protection
info), <b>-s</b> (convert spaces in filenames to underscores [DOS, OS/2, NT]) and
<b>-$</b> (restore volume label [DOS, OS/2, NT, Amiga]). <p>
(Support for regular ASCII
text-conversion may be removed in future versions, since it is simple enough
for the archive&rsquo;s creator to ensure that text files have the appropriate
format for the local OS.  EBCDIC conversion will of course continue to be
supported since the zipfile format implies ASCII storage of text files.)
<p>
See <a href='unzip.1'><i>unzip</i>(1)</a>
 for a more complete description of these modifiers.   
<h2><a name='sect6' href='#toc6'>Environment
Options</a></h2>
<i>unzipsfx</i> uses the same environment variables as <a href='unzip.1'><i>unzip</i>(1)</a>
 does, although
this is likely to be an issue only for the person creating and testing
the self-extracting archive.  See <a href='unzip.1'><i>unzip</i>(1)</a>
 for details.   
<h2><a name='sect7' href='#toc7'>Decryption</a></h2>
Decryption
is supported exactly as in <a href='unzip.1'><i>unzip</i>(1)</a>
; that is, interactively with a non-echoing
prompt for the password(s).  See <a href='unzip.1'><i>unzip</i>(1)</a>
 for details.  Once again, note
that if the archive has no encrypted files there is no reason to use a
version of <i>unzipsfx</i> with decryption support; that only adds to the size
of the archive.   
<h2><a name='sect8' href='#toc8'>Autorun Command</a></h2>
When <i>unzipsfx</i> was compiled with CHEAP_SFX_AUTORUN
defined, a simple &lsquo;&lsquo;command autorun&rsquo;&rsquo; feature is supported. You may enter a
command into the Zip archive comment, using the following format: <p>
 <br>
<pre>$AUTORUN$&gt;[command line string]
</pre>  <p>
When <i>unzipsfx</i> recognizes the &lsquo;&lsquo;$AUTORUN$&gt;&rsquo;&rsquo; token at the beginning of the
Zip archive comment, the remainder of the first line of the comment (until
the first newline character) is passed as a shell command to the operating
system using the C rtl &lsquo;&lsquo;system&rsquo;&rsquo; function. Before executing the command, <i>unzipsfx</i>
displays the command on the console and prompts the user for confirmation.
 When the user has switched off prompting by specifying the <b>-q</b> option, autorun
commands are never executed. <p>
In case the archive comment contains additional
lines of text, the remainder of the archive comment following the first
line is displayed normally, unless quiet operation was requested by supplying
a <b>-q</b> option.   
<h2><a name='sect9' href='#toc9'>Examples</a></h2>
To create a self-extracting archive <i>letters</i> from a
regular zipfile <i>letters.zip</i> and change the new archive&rsquo;s permissions to be
world-executable under Unix: <p>
 <br>
<pre>cat unzipsfx letters.zip &gt; letters
chmod 755 letters
zip -A letters
</pre>  <p>
To create the same archive under MS-DOS, OS/2 or NT (note the use of the
<b>/b</b> [binary] option to the <i>copy</i> command): <p>
 <br>
<pre>copy /b unzipsfx.exe+letters.zip letters.exe
zip -A letters.exe
</pre>  <p>
Under VMS: <p>
 <br>
<pre>copy unzipsfx.exe,letters.zip letters.exe
letters == "$currentdisk:[currentdir]letters.exe"
zip -A letters.exe
</pre>  <p>
(The VMS <i>append</i> command may also be used.  The second command installs
the new program as a &lsquo;&lsquo;foreign command&rsquo;&rsquo; capable of taking arguments.  The third
line assumes that Zip is already installed as a foreign command.) Under
AmigaDOS: <p>
 <br>
<pre>MakeSFX letters letters.zip UnZipSFX
</pre>  <p>
(MakeSFX is included with the UnZip source distribution and with Amiga
binary distributions.  &lsquo;&lsquo;zip -A&rsquo;&rsquo; doesn&rsquo;t work on Amiga self-extracting archives.)
To test (or list) the newly created self-extracting archive: <p>
 <br>
<pre>letters -t
</pre>  <p>
To test <i>letters</i> quietly, printing only a summary message indicating whether
the archive is OK or not: <p>
 <br>
<pre>letters -tqq
</pre>  <p>
To extract the complete contents into the current directory, recreating
all files and subdirectories as necessary: <p>
 <br>
<pre>letters
</pre>  <p>
To extract all *.txt files (in Unix quote the &lsquo;*&rsquo;): <p>
 <br>
<pre>letters *.txt
</pre>  <p>
To extract everything <i>except</i> the *.txt files: <p>
 <br>
<pre>letters -x *.txt
</pre>  <p>
To extract only the README file to standard output (the screen): <p>
 <br>
<pre>letters -c README
</pre>  <p>
To print only the zipfile comment: <p>
 <br>
<pre>letters -z
</pre>    
<h2><a name='sect10' href='#toc10'>Limitations</a></h2>
The principle and fundamental limitation of <i>unzipsfx</i> is
that it is not portable across architectures or operating systems, and
therefore neither are the resulting archives.  For some architectures there
is limited portability, however (e.g., between some flavors of Intel-based
Unix). <p>
Another problem with the current implementation is that any archive
with &lsquo;&lsquo;junk&rsquo;&rsquo; prepended to the beginning technically is no longer a zipfile
(unless <a href='zip.1'><i>zip</i>(1)</a>
 is used to adjust the zipfile offsets appropriately, as
noted above).  <a href='unzip.1'><i>unzip</i>(1)</a>
 takes note of the prepended bytes and ignores them
since some file-transfer protocols, notably MacBinary, are also known to
prepend junk.  But PKWARE&rsquo;s archiver suite may not be able to deal with the
modified archive unless its offsets have been adjusted. <p>
<i>unzipsfx</i> has no
knowledge of the user&rsquo;s PATH, so in general an archive must either be in
the current directory when it is invoked, or else a full or relative path
must be given.  If a user attempts to extract the archive from a directory
in the PATH other than the current one, <i>unzipsfx</i> will print a warning to
the effect, &lsquo;&lsquo;can&rsquo;t find myself.&rsquo;&rsquo;  This is always true under Unix and may be
true in some cases under MS-DOS, depending on the compiler used (Microsoft
C fully qualifies the program name, but other compilers may not).  Under
OS/2 and NT there are operating-system calls available that provide the
full path name, so the archive may be invoked from anywhere in the user&rsquo;s
path.  The situation is not known for AmigaDOS, Atari TOS, MacOS, etc. <p>
As
noted above, a number of the normal <a href='unzip.1'><i>unzip</i>(1)</a>
 functions have been removed
in order to make <i>unzipsfx</i> smaller:  usage and diagnostic info, listing
functions and extraction to other directories.  Also, only stored and deflated
files are supported.  The latter limitation is mainly relevant to those
who create SFX archives, however. <p>
VMS users must know how to set up self-extracting
archives as foreign commands in order to use any of <i>unzipsfx</i>&rsquo;s options. 
This is not necessary for simple extraction, but the command to do so then
becomes, e.g., &lsquo;&lsquo;run letters&rsquo;&rsquo; (to continue the examples given above). <p>
<i>unzipsfx</i>
on the Amiga requires the use of a special program, MakeSFX, in order to
create working self-extracting archives; simple concatenation does not work.
 (For technically oriented users, the attached archive is defined as a
&lsquo;&lsquo;debug hunk.&rsquo;&rsquo;)  There may be compatibility problems between the ROM levels
of older Amigas and newer ones. <p>
All current bugs in <a href='unzip.1'><i>unzip</i>(1)</a>
 exist in <i>unzipsfx</i>
as well.   
<h2><a name='sect11' href='#toc11'>Diagnostics</a></h2>
<i>unzipsfx</i>&rsquo;s exit status (error level) is identical to
that of <a href='unzip.1'><i>unzip</i>(1)</a>
; see the corresponding man page.   
<h2><a name='sect12' href='#toc12'>See Also</a></h2>
<a href='funzip.1'><i>funzip</i>(1)</a>
, <a href='unzip.1'><i>unzip</i>(1)</a>
,
<a href='zip.1'><i>zip</i>(1)</a>
, <a href='zipcloak.1'><i>zipcloak</i>(1)</a>
, <a href='zipgrep.1'><i>zipgrep</i>(1)</a>
, <a href='zipinfo.1'><i>zipinfo</i>(1)</a>
, <a href='zipnote.1'><i>zipnote</i>(1)</a>
, <a href='zipsplit.1'><i>zipsplit</i>(1)</a>
  
 
<h2><a name='sect13' href='#toc13'>URL</a></h2>
The Info-ZIP home page is currently at  <br>
<pre>http://www.info-zip.org/pub/infozip/
</pre>  or  <br>
<pre>ftp://ftp.info-zip.org/pub/infozip/ .
</pre>    
<h2><a name='sect14' href='#toc14'>Authors</a></h2>
Greg Roelofs was responsible for the basic modifications to
UnZip necessary to create UnZipSFX.  See <a href='unzip.1'><i>unzip</i>(1)</a>
 for the current list of
Zip-Bugs authors, or the file CONTRIBS in the UnZip source distribution
for the full list of Info-ZIP contributors.  <p>

<hr><p>
<a name='toc'><b>Table of Contents</b></a><p>
<ul>
<li><a name='toc0' href='#sect0'>Name</a></li>
<li><a name='toc1' href='#sect1'>Synopsis</a></li>
<li><a name='toc2' href='#sect2'>Description</a></li>
<li><a name='toc3' href='#sect3'>Arguments</a></li>
<li><a name='toc4' href='#sect4'>Options</a></li>
<li><a name='toc5' href='#sect5'>Modifiers</a></li>
<li><a name='toc6' href='#sect6'>Environment Options</a></li>
<li><a name='toc7' href='#sect7'>Decryption</a></li>
<li><a name='toc8' href='#sect8'>Autorun Command</a></li>
<li><a name='toc9' href='#sect9'>Examples</a></li>
<li><a name='toc10' href='#sect10'>Limitations</a></li>
<li><a name='toc11' href='#sect11'>Diagnostics</a></li>
<li><a name='toc12' href='#sect12'>See Also</a></li>
<li><a name='toc13' href='#sect13'>URL</a></li>
<li><a name='toc14' href='#sect14'>Authors</a></li>
</ul>
</body>
</html>
